# !/usr/bin/env python3
# -*- coding: utf-8 -*-
# aim:    练习collection模块的使用
# author: wangkaixuan
# email:  26554189525@qq.com 
# date:   2018/1/9

from collections import namedtuple,deque,defaultdict,OrderedDict,Counter

P = namedtuple('PointInSpace',['x','y','z'])
point = P(1, 2, 3)
print('Point:', point.x, point.y, point.z)
print(type(point))

d = deque(['a','b','c'])
d.append('x')
d.appendleft('y')
for i in d:
    print(i)

de = defaultdict(lambda:'NoThing')
de['name'] = 'wangkaixuan'
de['age'] = 23
de['height'] = 175
print(de)

od = OrderedDict()
od['name'] = 'wangkaixuan'
od['age'] = 23
od['height'] = 175

print(od)

ct = Counter()
for ch in 'Wangkaixuan':
    ct[ch] = ct[ch] + 1
print(ct)